//
//  LoginView.swift
//  WYYao
//
//  Created by wangcl on 2024/9/11.
//

import SwiftUI
//resizable:修饰符可以对Image图片进行缩放，使图片缩放到模拟器显示范围内
//edgesIgnoringSafeArea:可对视图忽略其安全区域
struct LoginView: View {
    @EnvironmentObject var viewModel:ViewModel
    var body: some View {
        ZStack(content: {
            Image("scenery").resizable().edgesIgnoringSafeArea(.all)
            VStack(alignment:.leading,spacing: 400) {
                VStack(alignment:.leading,spacing: 10) {
                    Text("开启你的新世界")
                        .cl_foregroundColor(.green)
                        .font(.system(size: 30,weight: .bold))
                        .shadow(color: .white, radius: 2, x: 2, y: 2)
                    Text("首次登录自动创建新账号")
                        .cl_foregroundColor(.green)
                        .font(.system(size: 17))
                        .shadow(color: .white, radius: 2, x: 2, y: 2)
                }
                VStack(spacing:40) {
                    VStack(alignment:.center,spacing:15) {
                        Button(action: {
                            viewModel.isLogin = true
                        }, label: {
                            Text("手机号码登录")
                                .font(.system(size: 17,weight: .bold))
                                .frame(maxWidth: .infinity)
                                .padding()
                                .cl_foregroundColor(.white)
                                .background(Color.red)
                                .cornerRadius(9)
                        })
                        Button(action: {
                            viewModel.isLogin = true
                        }, label: {
                            Text("微信登录")
                                .font(.system(size: 17,weight: .bold))
                                .frame(maxWidth: .infinity)
                                .padding()
                                .cl_foregroundColor(.black)
                                .background(Color.white)
                                .cornerRadius(9)
                        })
                    }
                    HStack(alignment: .bottom) {
                        Text("等了即表明同意").cl_foregroundColor(.white)
                        Button(action: {}, label: {
                            Text("用户协议")
                        })
                        Text("和").cl_foregroundColor(.white)
                        Button(action: {}, label: {
                            Text("隐私政策")
                        })
                    }
                }
               
            }.padding()
        })
    }
}

#Preview {
    LoginView()
}
